﻿using FDEE.Model;
using FDEEPublicFunc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FDEEMain
{
    public partial class DeckSlabCurveParaForm : Form
    {
        /// <param name="width">桥面总宽</param>
        /// <param name="widthOuter">桥面外宽</param>
        /// <param name="span">理论跨径</param>
        /// <param name="beamWA">小桩号侧盖梁宽</param>
        /// <param name="beamWB">大桩号侧盖梁宽</param>
        /// <param name="endA">小桩号桥面类型</param>
        /// <param name="endB">大桩号桥面类型</param>
        /// <param name="inGirderA">A侧内梁端距离</param>
        /// <param name="inGirderB">B侧内梁端距离</param>
        /// <param name="exGirderA">A侧外梁端距离</param>
        /// <param name="exGirderB">B侧外梁端距离</param>
        public int width = 0, widthOuter = 0, span = 0, radius = 0, beamWA = 0, beamWB = 0,R=0,inGirderA=0,  inGirderB=0,  exGirderA=0,  exGirderB=0;
        public eEndType endA=eEndType.LinkSlab, endB = eEndType.LinkSlab;
        public string pierParas = "";
        public string title = "";
        public DeckSlabCurveParaForm()
        {
            InitializeComponent();
            cbLine.SelectedIndex = 0;
            InitType();
        }

      
        private void InitType()
        {

            var values = Enum.GetValues(typeof(FDEE.Model.eEndType));
            int index = 0;


            foreach (var item in values)
            {
                cbEndA.Items.Add(item);
                ++index;
            }
            cbEndA.SelectedIndex = 0;

            foreach (var item in values)
            {
                cbEndB.Items.Add(item);
                ++index;
            }
            cbEndB.SelectedIndex = 0;
        }


        private void btnConfim_Click(object sender, EventArgs e)
        {
            try
            {
                title = cbLine.Text;
                pierParas = pierPara.Text;
                if (string.IsNullOrWhiteSpace(txtwidth.Text))
                {
                    MessageBox.Show("请设置桥面总宽值！", "提示");
                    return;
                };
                if (string.IsNullOrWhiteSpace(txtwidthOuter.Text))
                {
                    MessageBox.Show("请设置桥面外宽值！", "提示");
                    return;
                };
                if (string.IsNullOrWhiteSpace(txtspan.Text))
                {
                    MessageBox.Show("请设置理论跨径值！", "提示");
                    return;
                };
                if (string.IsNullOrWhiteSpace(txtbeamWA.Text))
                {
                    MessageBox.Show("请设置小桩号侧盖梁宽值！", "提示");
                    return;
                };
                if (string.IsNullOrWhiteSpace(txtbeamWB.Text))
                {
                    MessageBox.Show("请设置大桩号侧盖梁宽值！", "提示");
                    return;
                };
                if (string.IsNullOrWhiteSpace(txtR.Text))
                {
                    R = 0;
                }
                else
                {
                    width = int.Parse(txtR.Text);
                }
                if (string.IsNullOrWhiteSpace(txtinGirderA.Text))
                {
                    inGirderA = 0;
                }
                else
                {
                    inGirderA = int.Parse(txtinGirderA.Text);
                }
                if (string.IsNullOrWhiteSpace(txtinGirderB.Text))
                {
                    inGirderB = 0;
                }
                else
                {
                    inGirderB = int.Parse(txtinGirderB.Text);
                }
                if (string.IsNullOrWhiteSpace(txtexGirderA.Text))
                {
                    exGirderA = 0;
                }
                else
                {
                    exGirderA = int.Parse(txtexGirderA.Text);
                }
                if (string.IsNullOrWhiteSpace(txtexGirderB.Text))
                {
                    inGirderB = 0;
                }
                else
                {
                    inGirderB = int.Parse(txtexGirderB.Text);
                }
                width = int.Parse(txtwidth.Text);
                widthOuter = int.Parse(txtwidthOuter.Text);
                span = int.Parse(txtspan.Text);
                beamWA = int.Parse(txtbeamWA.Text);
                beamWB = int.Parse(txtbeamWB.Text);
                endA =(FDEE.Model.eEndType)cbEndA.SelectedIndex;
                endB= (FDEE.Model.eEndType)cbEndB.SelectedIndex;
                pierParas = pierPara.Text;              
                title = cbLine.Text;
               
            }
            catch
            {

            }
            this.DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }


    }
}
